package com.go.where.family.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.go.where.family.dao.CustomerDao;
import com.go.where.family.pojo.CustomerInfo;

@Repository("customerDao")
public class CustomerDaoImpl extends BaseDaoImpl<CustomerInfo, String>
		implements CustomerDao {

	@Override
	public String getNameSpace() {
		return "mybatis.xml.CustomerMapper";
	}

	@Override
	public CustomerInfo queryByMyInviteCode(String myInviteCode) {
		return this.getSqlSession().selectOne(
				getNameSpace() + ".queryByMyInviteCode", myInviteCode);
	}

	@Override
	public int updatePwd(CustomerInfo info) {
		return this.getSqlSession().update(getNameSpace() + ".updatePwd", info);
	}

	@Override
	public CustomerInfo queryByMobile(String mobile) {
		return this.getSqlSession().selectOne(
				getNameSpace() + ".queryByMobile", mobile);
	}

	@Override
	public int UpdateAccount(CustomerInfo info) {
		return this.getSqlSession().update(getNameSpace() + ".update", info);
	}

	@Override
	public List<CustomerInfo> getUserListByUserIds(Map<String, Object> para) {
		return this.getSqlSession().selectList(
				getNameSpace() + ".getUserListByUserIds", para);
	}

	@Override
	public List<CustomerInfo> getUserListByMobiles(Map<String, Object> para) {
		return this.getSqlSession().selectList(
				getNameSpace() + ".getUserListByMobiles", para);
	}

	@Override
	public List<String> getUserIdList(Map<String, Object> para) {
		return this.getSqlSession().selectList(
				getNameSpace() + ".getUserIdList", para);
	}

	@Override
	public CustomerInfo queryByCustomerNick(String customerNick) {
		return getSqlSession().selectOne(
				getNameSpace() + ".queryByCustomerNick", customerNick);
	}

}
